package com.bawei.remote.factory;

import com.bawei.common.core.domain.R;
import com.bawei.domain.query.DocDeleteReq;
import com.bawei.domain.request.DocInfoReq;
import com.bawei.remote.api.RemoteEsDocService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class RemoteEsDocFallBackFactory implements FallbackFactory<RemoteEsDocService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteEsDocFallBackFactory.class);


    @Override
    public RemoteEsDocService create(Throwable cause) {
        return new RemoteEsDocService() {
            @Override
            public R createDoc(DocInfoReq docInfoReq) {
                return R.fail("调用Es服务插入数据失败");
            }

            @Override
            public R delete(DocDeleteReq docDeleteReq) {
                return R.fail("调用Es删除服务失败");
            }

        };
    }
}
